<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="htmlId">
<head>
    <title>Coverage Report :: SquareTest</title>
    <style type="text/css">
        @import "../../.css/coverage.css";
    </style>
</head>

<body>
<div class="header"></div>

<div class="content">
    <div class="breadCrumbs">
        [ <a href="../../index.html">all classes</a> ]
        [ <a href="../index.html">nl.tudelft.jpacman.board</a> ]
    </div>

    <h1>Coverage Summary for Class: SquareTest (nl.tudelft.jpacman.board)</h1>

    <table class="coverageStats">
        <tr>
            <th class="name">Class</th>
            <th class="coverageStat
">
                Class, %
            </th>
            <th class="coverageStat
">
                Method, %
            </th>
            <th class="coverageStat
">
                Line, %
            </th>
        </tr>
        <tr>
            <td class="name">SquareTest</td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 1)
  </span>
            </td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 5)
  </span>
            </td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 14)
  </span>
            </td>
        </tr>

    </table>

    <br/>
    <br/>


    <div class="sourceCode"><i>1</i>&nbsp;package nl.tudelft.jpacman.board;
        <i>2</i>&nbsp;
        <i>3</i>&nbsp;import org.junit.jupiter.api.BeforeEach;
        <i>4</i>&nbsp;import org.junit.jupiter.api.Test;
        <i>5</i>&nbsp;
        <i>6</i>&nbsp;import static org.assertj.core.api.Assertions.assertThat;
        <i>7</i>&nbsp;import static org.mockito.Mockito.mock;
        <i>8</i>&nbsp;
        <i>9</i>&nbsp;/**
        <i>10</i>&nbsp; * Test suite to confirm the public API of {@link Square} works as desired.
        <i>11</i>&nbsp; *
        <i>12</i>&nbsp; * @author Jeroen Roosen
        <i>13</i>&nbsp; */
        <b class="nc"><i>14</i>&nbsp;class SquareTest {</b>
        <i>15</i>&nbsp;
        <i>16</i>&nbsp; /**
        <i>17</i>&nbsp; * The square under test.
        <i>18</i>&nbsp; */
        <i>19</i>&nbsp; private Square square;
        <i>20</i>&nbsp;
        <i>21</i>&nbsp; /**
        <i>22</i>&nbsp; * Resets the square under test.
        <i>23</i>&nbsp; */
        <i>24</i>&nbsp; @BeforeEach
        <i>25</i>&nbsp; void setUp() {
        <b class="nc"><i>26</i>&nbsp; square = new BasicSquare();</b>
        <i>27</i>&nbsp; }
        <i>28</i>&nbsp;
        <i>29</i>&nbsp; /**
        <i>30</i>&nbsp; * Assert that the square holds the occupant once it has occupied it.
        <i>31</i>&nbsp; */
        <i>32</i>&nbsp; @Test
        <i>33</i>&nbsp; void testOccupy() {
        <b class="nc"><i>34</i>&nbsp; Unit occupant = mock(Unit.class);</b>
        <b class="nc"><i>35</i>&nbsp; square.put(occupant);</b>
        <i>36</i>&nbsp;
        <b class="nc"><i>37</i>&nbsp; assertThat(square.getOccupants()).contains(occupant);</b>
        <i>38</i>&nbsp; }
        <i>39</i>&nbsp;
        <i>40</i>&nbsp; /**
        <i>41</i>&nbsp; * Assert that the square no longer holds the occupant after it has left the
        <i>42</i>&nbsp; * square.
        <i>43</i>&nbsp; */
        <i>44</i>&nbsp; @Test
        <i>45</i>&nbsp; void testLeave() {
        <b class="nc"><i>46</i>&nbsp; Unit occupant = mock(Unit.class);</b>
        <b class="nc"><i>47</i>&nbsp; square.put(occupant);</b>
        <b class="nc"><i>48</i>&nbsp; square.remove(occupant);</b>
        <i>49</i>&nbsp;
        <b class="nc"><i>50</i>&nbsp; assertThat(square.getOccupants()).doesNotContain(occupant);</b>
        <i>51</i>&nbsp; }
        <i>52</i>&nbsp;
        <i>53</i>&nbsp; /**
        <i>54</i>&nbsp; * Assert that the order in which units entered the square is preserved.
        <i>55</i>&nbsp; */
        <i>56</i>&nbsp; @Test
        <i>57</i>&nbsp; void testOrder() {
        <b class="nc"><i>58</i>&nbsp; Unit o1 = mock(Unit.class);</b>
        <b class="nc"><i>59</i>&nbsp; Unit o2 = mock(Unit.class);</b>
        <b class="nc"><i>60</i>&nbsp; square.put(o1);</b>
        <b class="nc"><i>61</i>&nbsp; square.put(o2);</b>
        <i>62</i>&nbsp;
        <b class="nc"><i>63</i>&nbsp; assertThat(square.getOccupants()).containsSequence(o1, o2);</b>
        <i>64</i>&nbsp; }
        <i>65</i>&nbsp;}
    </div>
</div>

<div class="footer">

    <div style="float:right;">generated on 2023-04-25 16:45</div>
</div>
</body>
</html>
